package br.com.tarlis.core.client;

import java.util.Map;

import br.com.tarlis.core.client.exception.SerializableException;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("do")
public interface ActionService extends RemoteService {
	
	<K> Map<String, K> doAction(String action, Map<String, K> parameters) throws SerializableException;
	
	/**
	 * Utility class for simplifying access to the instance of async service.
	 */
	public static class Util {
		private static ActionServiceAsync instance;
		public static ActionServiceAsync getInstance(){
			if (instance == null) {
				instance = GWT.create(ActionService.class);
			}
			return instance;
		}
	}
}
